<!DOCTYPE html>
<html lang="${lang}">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	
	<title>${"zh"==lang ? "表单设计" : "Form Designer"}</title>
	<link rel="shortcut icon" type="image/x-icon" href="${cdnfmd}/static/images/form/favicon.ico" />
	
	<link rel="stylesheet" href="${cdnfmd}/static/js/jquery-ui1.10.4/jquery-ui.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/js/jquery-ui1.10.4/jquery.ui.theme.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/css/dhtmlx4/skins/${fmdProperties.dhxskin}_${fmdProperties.dhxtheme}/dhtmlx.css?${productionVersion}">
	
	<link rel="stylesheet" href="${cdnfmd}/static/css/platform/form/formoid-default-skyblue.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/css/platform/form/formbasic.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/css/platform/form/formdesigner.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/css/platform/form/formdesigner_elem.css?${productionVersion}">
	<link rel="stylesheet" href="${cdnfmd}/static/css/3rdpartyother/tipsy.css?${productionVersion}">
	
	<script src="${cdnfmd}/static/js/jquery/jquery-1.10.2.js?${productionVersion}" type="text/javascript"></script>
	<script src="${cdnfmd}/static/js/jquery/jquery.tipsy.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/jquery-ui1.10.4/jquery-ui.js?${productionVersion}" type="text/javascript"></script>
	
	<script src="${cdnfmd}/static/js/dhtmlx4/dhtmlx.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/dhtmlx4/ext/dhxgrid.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/dhtmlx4/ext/dhxwindow.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/dhtmlx4/ext/excell_types.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/dhtmlx4/ext/validator.js?${productionVersion}"></script>
	
	<script src="${cdnfmd}/static/js/ace/ace.js?${productionVersion}" type="text/javascript" charset="utf-8"></script>
	
	<script src="${cdnfmd}/static/js/3rdpartyother/json2.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/3rdpartyother/jsonselect.min.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/util/common.js?${productionVersion}"></script>
	
	<script src="${cdnfmd}/static/js/platform/form/formdesigner_i18n_${lang}.js?${productionVersion}"></script>
	<script src="${cdnfmd}/static/js/platform/form/formdesigner_elem_i18n_${lang}.js?${productionVersion}"></script>

</head>
<body>
<div class="wait">
	<div>
		<div><img src='${cdnfmd}/static/images/loading.gif'></div>
		<div class="waitMsg"></div>
	</div>
</div>
<div id="popupselector" style="display:none">
	<iframe id="popupselectorFrame" name="popupselectorFrame" src="" frameborder="0" width="100%" scroll="no" height="100%"></iframe>
</div>
<div id="fmdmaindiv"></div>
<script src="${cdnfmd}/static/js/platform/form/formdesigner.js?${productionVersion}"></script>
<script src="${cdnfmd}/static/js/platform/form/formdesigner_elem.js?${productionVersion}"></script>
<script src="${cdnfmd}/static/js/platform/form/formdesigner_propfunc.js?${productionVersion}"></script>
<script>

var designer = new Designer();
window.onload = function() {

	designer.waitstart();
	
	//context path
	deployVersion = '${productionVersion}';
	ctxpath = '${ctxPath}';
	resloc = "${cdnfmd}";
	
	//dhx constants
	dhx_skin = "${fmdProperties.dhxskin}";
	dhtmlx.image_path = resloc + '/static/css/dhtmlx4/skins/${fmdProperties.dhxskin}_${fmdProperties.dhxtheme}/imgs/';

	var fmdvar = {};
	fmdvar.lang = '${lang}';
	fmdvar.imagepath = resloc + '/static/images/form/';
	fmdvar.moduleiconpath = resloc + '/static/images/form/designer/modules/';
	fmdvar.inputformtype = "${has(formtype)?formtype:''}";
	fmdvar.advanced = ${fmdProperties.advanced};
	fmdvar.printEnabled = ${fmdProperties.printEnabled};
	fmdvar.elemAttachEnabled = ${fmdProperties.elementattachmentEnabled};
	fmdvar.isEditor = ${isEditor};
	fmdvar.moduleExcludes = "${fmdProperties.filterModuleExcludes}";
	fmdvar.bpmpCtx = "/bpmp-engine";
    fmdCtx = "${fmdCtx}"; //workaround for prop js
	fmdvar.fmdCtx = "${fmdCtx}";
	fmdvar.roleselrest = "${fmdProperties.bpmpRoleSelectRest}";
	fmdvar.roleselurl = "${fmdProperties.bpmpRoleSelectUrl}";
	fmdvar.imp_comp = ${fmdProperties.impComp};
	
	//init component basic vars
	designer.initMeta(fmdvar);
	designer.initVar(fmdvar);
	
	//load modules
	try {
		designer.waitstart();
		var modules_control = ${moduleControls};
		designer.loadModules(resloc + '${fmdProperties.modulesPathControl}', modules_control, deployVersion);
	} catch(e){
		dhtmlx.message({expire:-1,type:"error",
			text:"对不起，组件加载失败，请联系您的服务提供商！<br/>An error has occured while loading modules.<br/> Please contact the vendor!<br/>"+e
			});
	}

	//init
	var formid = "${has(formid)?formid:''}";
	var versionid = "${has(versionid)?versionid:''}";

	designer.waitend();
	
	designer.init(formid, versionid);

    window.onresize = function() {
        designer.onresize();
    }
};
</script>

</body>
</html>
